package com.woniuxy.oa.dao;

import com.woniuxy.oa.dao.provider.NoticeProvider;
import com.woniuxy.oa.entity.Notice;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface NoticeDAO {
    /**
     * 增加
     *
     * @param notice
     */
    @Insert("insert into oa_notice values(#{id},#{title},#{content},#{pubDate},#{pubId},#{status},#{image})")
            public void add(Notice notice);

    /**
     * 修改
     *
     * @param notice
     */
    @Update("update oa_notice set title=#{title},content=#{content},pubDate=#{pubDate},pubId=#{pubId},image=#{image},status=#{status} where id=#{id}")
    public void update(Notice notice);

    /**
     * 通过ID删除
     *
     * @param id
     */
    @Delete("delete from oa_notice where id =#{id}")
    public void delete(String id);

    /**
     * 条件查询所有
     *
     * @return
     */
    @SelectProvider(type = NoticeProvider.class, method = "getSQL")
    public List<Notice> getAll(Notice notice);
}
